<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\User;
use App\Models\Room;
use App\Models\Dish;
use App\Models\Menu;
use App\Models\Order;
use Illuminate\Http\Request;
use Illuminate\View\View;

class DashboardController extends Controller
{
    /**
     * 仪表板首页
     */
    public function index(): View
    {
        // 获取统计数据
        $stats = [
            'users' => User::count(),
            'rooms' => Room::count(),
            'active_rooms' => Room::where('status', 'active')->count(),
            'dishes' => Dish::count(),
            'menus' => Menu::count(),
            'orders' => Order::count(),
            'today_orders' => Order::whereDate('created_at', today())->count(),
        ];

        return view('admin.dashboard.index', compact('stats'));
    }
}